# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=multipath-tools
pkgver=0.8.4
pkgrel=1
pkgdesc="Device Mapper Multipathing Driver"
url="http://christophe.varoqui.free.fr"
arch="all"
license="GPL-2.0-only"
depends="eudev device-mapper"
makedepends="lvm2-dev libaio-dev readline-dev ncurses-dev eudev-dev
	userspace-rcu-dev json-c-dev perl"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://git.opensvc.com/gitweb.cgi?p=multipath-tools/.git;a=snapshot;h=$pkgver;sf=tgz
	json-c-0.14.patch
	multipath-tools.conf
	multipath.initd
	multipathd.initd

	0001-OPTFLAGS-patch.patch
	"
options="!check"

prepare() {
	# Rename unpacked directory with hash in the name to something sane...
	mv "$srcdir"/multipath-tools-$pkgver-* "$builddir"

	default_prepare
}

build() {
	make -j1 prefix="/usr" \
		sysconfdir="/etc" \
		mandir="/usr/share/man" \
		infodir="/usr/share/info"
}

package() {
	make -j1 DESTDIR="$pkgdir" install

	install -D -m644 "$srcdir"/$pkgname.conf \
		"$pkgdir"/etc/multipath.conf
	install -D -m755 "$srcdir"/multipathd.initd \
		"$pkgdir"/etc/init.d/multipathd
	install -D -m755 "$srcdir"/multipath.initd \
		"$pkgdir"/etc/init.d/multipath
}

sha512sums="720823188c053c1c50269a30e34a9d69099098495bfd607076bcfa2c079565e3f0580c91783f19d42ed82290c0db98e4e19ef620eca4ee5ec7885c49c72d2307  multipath-tools-0.8.4.tar.gz
fae0e1fbc7dfe6d932a5b19e9a80efdc30a2bad3ac4e24ff2f8ec9b156107378b5f15d4bec8c32dbfd87286cd7e30b4acebfadda416365f108dafeea0321318a  json-c-0.14.patch
e81462b22c0cbc92ea935d7544b9f9a0c4ccbcf13f3bc03dadf6de96407c9cf49964c9bbf02f12a134e1255c66421c6fde39d54b15eef975e8df81bdc88b2213  multipath-tools.conf
97deeee57daee787d807da0a4dbf50baae047ddcda30925f7000ec822b5a17a3dc55196c3e032c8ffbc2caeac690ce5ca485b0a7c99f15e66bddaa000439112a  multipath.initd
2f913fed199f12f048eb042b5bb1a326f6f09cfe63d572ac269461d96ebf25b251576de22be7ba9ab631ded7af6fd47dac38fda3b29d00640c806181eb37447c  multipathd.initd
909054c95bd2ee6a2651ad2849c4308342ba17c05ce557dc751c0ce3efc8a10f733cb6efa25d07b1f519858c05dadaf6622fac6e233a02cfedf53f99f28065d9  0001-OPTFLAGS-patch.patch"
